package org.dalmatian.common.core.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;


@Getter
@AllArgsConstructor
public enum IntegralTypeEnum {
    //积分记录类型
    DAILY_QUESTION("每日答题", "0"),
    WEEKLY_QUESTION("每周答题", "1"),
    MONTHLY_QUESTION("每月一考", "2"),
    CHALLENGE_QUESTION("挑战答题", "3"),
    CLASS_VIDEO_LEARNING("班级视频学习", "4"),
    MARKET_VIDEO_LEARNING("订阅视频学习", "10"),
    TASK_VIDEO_LEARNING("任务视频学习", "11"),
    READ_ARTICLES("阅读文章", "5"),
    SECURITY_CONSULT("安全咨询", "7"),
    NOTIFICATION("通知公告", "8"),
    LEARNING_MATERIAL("学习资料", "9");


    private final String name;
    private final String value;

    // 静态方法，通过name获取对应的value
    public static String getValueByName(String name) {
        for (IntegralTypeEnum enumValue : IntegralTypeEnum.values()) {
            if (enumValue.getName().equals(name)) {
                return enumValue.getValue();
            }
        }
        throw new IllegalArgumentException("No matching constant for name: " + name);
    }

    // 静态方法，通过value获取对应的name
    public static String getNameByValue(String value) {
        for (IntegralTypeEnum enumValue : IntegralTypeEnum.values()) {
            if (enumValue.getValue().equals(value)) {
                return enumValue.getName();
            }
        }
        throw new IllegalArgumentException("No matching constant for value: " + value);
    }
}
